package com.cloudsea.yunhaistores.controller;


import com.cloudsea.yunhaistores.service.MenuService;
import com.cloudsea.yunhaistores.vo.MenuVO;
import com.cloudsea.yunhaiutils.common.ApiResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "用户-菜单浏览", description = "用户扫码后，获取门店的完整菜单信息")
@RestController
@RequestMapping("/menu")
public class MenuController {

    @Autowired
    private MenuService menuService;

    @Operation(summary = "获取门店的完整菜单", description = "根据门店ID，返回该门店下所有在售商品、规格(SKU)和属性的结构化数据")
    @GetMapping
    public ApiResponse<MenuVO> getMenu(@Parameter(description = "门店ID", required = true) @RequestParam Long storeId) {
        MenuVO menu = menuService.getMenuByStoreId(storeId);
        return ApiResponse.success(menu);
    }
}